Returns the number of date intervals between two given date values.
指定された 2 つの日付値の間の日付間隔の数を返します。
DateDiff (Add, Date1, Date2 [, Week_start [, Year_start]])
DateDiff (Add, Date1, Date2 [, Week_start [, Year_start]])
A number.
数値。
Add - A string expression from the following table, specifying the date interval.
Add - 日付の間隔を指定する、後続のテーブルからの文字列式。
Date1, Date2 - The two date values to be compared.
Date1, Date2 - 比較する 2 つの日付値。
Week_start - An optional parameter that specifies the starting day of a week.
Week_start - 週の開始曜日を指定するオプションのパラメータ。
|
Week_start value
|
Explanation
|
|
0
|
Use system default value
|
|
1
|
Sunday (default)
|
|
2
|
Monday
|
|
3
|
Tuesday
|
|
4
|
Wednesday
|
|
5
|
Thursday
|
|
6
|
Friday
|
|
7
|
Saturday
|
Year_start - An optional parameter that specifies the starting week of a year.
Year_start - 年の開始週を指定するオプションのパラメータ。
|
Year_start value
|
Explanation
|
|
0
|
Use system default value
|
|
1
|
Week 1 is the week with January, 1st (default)
|
|
2
|
Week 1 is the first week containing four or more days of that year
|
|
3
|
Week 1 is the first week containing only days of the new year
|
Sub example_datediff
Sub example_datediff
msgbox DateDiff("d", "1/1/2005", "12/31/2005")
msgbox DateDiff("d", "1/1/2005", "12/31/2005")
End Sub
End Sub